package com.faithbj.device.model.entity;

import java.math.BigDecimal;
import java.util.Date;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;

/**
 * 出入库单的总览表
 *
 */
@Entity
public class Stock extends BaseEntity{

	/**
	 * 
	 */
	private static final long serialVersionUID = 8139995232262702630L;

	//出入库编号
	private String code;
	
	//出入库总额
	private BigDecimal price;
	
	//出入库日期
	private Date date;
	
	//经手人
	private String stockor;
	
	//摘要
	private String description;
	
	//备注
	private String comments;
	
	private Set<StockItem> stockDetailSet;
	
	//1为入库，0为出库
	private int isInStock;
	
	public Stock() {
	}


	public String getCode() {
		return code;
	}


	public void setCode(String code) {
		this.code = code;
	}


	public BigDecimal getPrice() {
		return price;
	}


	public void setPrice(BigDecimal price) {
		this.price = price;
	}


	public String getStockor() {
		return stockor;
	}


	public void setStockor(String stockor) {
		this.stockor = stockor;
	}


	public int getIsInStock() {
		return isInStock;
	}


	public void setIsInStock(int isInStock) {
		this.isInStock = isInStock;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getComments() {
		return comments;
	}

	public void setComments(String comments) {
		this.comments = comments;
	}
	
	@OneToMany(mappedBy = "stock", fetch = FetchType.LAZY)
	@Cascade(value = { CascadeType.ALL })
	@OrderBy("createDate desc")
	public Set<StockItem> getStockDetailSet() {
		return stockDetailSet;
	}

	public void setStockDetailSet(Set<StockItem> stockDetailSet) {
		this.stockDetailSet = stockDetailSet;
	}

}
